extends "../calxsx_1_2/calxsx_1_2.gd"
func _init():
	pass
func _extInit():
	._extInit()
	chaName = "沧浪梅卡"                   # 角色的名称
	atkEff = "atk_dang" 
	xb = "水"
	lv = 4
	addSkillTxt("[color=#FFFF00][精灵王的救赎][/color]:[color=#FFCC22]叹息的水龙卷席卷敌方单体5次，每段为75%的水系魔法伤害，30%概率令目标冰冻3秒\n提升魔攻，魔防，暴击，攻速各10%，最高60%，若造成克制伤害，则70%概率冰冻[CD:17][/color]")
	addSkillTxt("[color=#FFFF00][精灵王之力][/color][color=#FFCC22]水流的力量使梅卡的技能可以暴击[/color]")
	addCdSkill("jiushu",17)
	
func _castCdSkill(id):
	._castCdSkill(id)
	if id == "jiushu":
		var dmg = att.mgiAtk*0.75
		var txt = "精灵王的救赎"
		if ln >= 1:
			ln -= 1
			dmg *= 1.5
			txt = "源·" + txt
		var eff = sys.newEff("numHit", position, false, 1)
		eff.setText(txt, "#FF0099")
		eff.anim.set_speed_scale(0.2)
		for i in range(5):
			typeHurtCha(aiCha,dmg,Chara.HurtType.MGI,Chara.AtkType.SKILL)
		var buff = hasBuff("baoji1")
		var bf1 = hasBuff("mogong1")
		var bf2 = hasBuff("mokang1")
		var bf3 = hasBuff("gongsu1")
		if buff == null:
			addBuff(bf.baoji1.new())
		elif buff.att.cri < 0.6:
			buff.att.cri += 0.1
		if bf1 == null:
			addBuff(bf.mogong1.new())
		elif bf1.att.mgiAtkL < 0.6:
			bf1.att.mgiAtkL += 0.1
		if bf2 == null:
			addBuff(bf.mokang1.new())
		elif bf2.att.mgiDefL < 0.6:
			bf2.att.mgiDefL += 0.1
		if bf1 == null:
			addBuff(bf.gongsu1.new())
		elif bf3.att.spd < 0.6:
			bf3.att.spd += 0.1
		if aiCha.xb == "火":
			if sys.rndPer(70):
				aiCha.addBuff(bf.jiyun.new(6))
		elif aiCha.xb == "暗":
			if sys.rndPer(70):
				aiCha.addBuff(bf.jiyun.new(6))
		else:
			if sys.rndPer(30):
				aiCha.addBuff(bf.jiyun.new(6))

func _onAtkInfo(atkInfo):
	._onAtkInfo(atkInfo)
	if atkInfo.atkCha == self && atkInfo.atkType == Chara.AtkType.SKILL:
		atkInfo.canCri = true